package com.android.accessibility.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Toast;

import com.android.accessibility.R;
import com.android.accessibility.base.BaseFragment;
import com.android.accessibility.utils.Utils;

public class SettingsFragment extends BaseFragment implements OnClickListener {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.settings_layout, null);
        initView(view);
        return view;
    }

    private void initView(View view) {
        View generateAuthView = view.findViewById(R.id.generate_authcode);
        generateAuthView.setOnClickListener(this);
        View checkChannelVeiw = view.findViewById(R.id.check_channel);
        checkChannelVeiw.setOnClickListener(this);
    }

    private void checkChannel() {
        String channel = Utils.getChannelName(getActivity());
        Toast.makeText(getActivity(), "当前渠道 : " + channel, Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.generate_authcode) {
        } else if (v.getId() == R.id.check_channel) {
            checkChannel();
        }
    }
}
